import cv2

window_name = 'My Window'

clicked = False


def onMouse(event, x, y, flags, param):
    global clicked
    if event == cv2.EVENT_LBUTTONUP:
        clicked = True


camera_capture = cv2.VideoCapture(0)
cv2.namedWindow(window_name)
cv2.setMouseCallback(window_name, onMouse)

success, frame = camera_capture.read()
while success and cv2.waitKey(1) == -1 and not clicked:
    cv2.imshow(window_name, frame)
    success, frame = camera_capture.read()
